package com.lin.cloud.disk.oss.config;

import io.minio.MinioClient;
import lombok.SneakyThrows;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ljc
 * @date 2020/12/26 15:19
 */
@Configuration
public class MinIoConfig {

    @Value("${minio.endPoint}")
    private String endPoint;

    @Value("${minio.accessKey}")
    private String accessKey;

    @Value("${minio.secretKey}")
    private String secretKey;

    @SneakyThrows
    @Bean
    public MinioClient minioClient(){
//        MinioClient client = new MinioClient(endPoint,accessKey,secretKey);
        MinioClient client = new MinioClient.Builder().endpoint(endPoint).credentials(accessKey,secretKey).build();
        return client;
    }

}
